<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html; charset=big5" language="java" import="util.*, java.sql.*,beans.*, java.util.*" errorPage="" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Welcome to the Captain Hook's store</title>
    <link href="zstyles.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        <!--
.style5 {color: #000033}
.style7 {color: #FFFFFF}
-->
    </style>
    <script src="scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<body>
<div class="absolute_title">Captain Hook's Store</div>
<div class="absolute_title2">
    <h5>
        <%
        String username = (String)session.getAttribute("username");
        
        if(username==null) {
            out.println("Please <a href='login.jsp'>Login.</a>");
        }else {
        %>
        <h5>Hi!<%= username%><br/>
        <a href="logout.jsp"> Click here to logout</a></h5>
        <% }
        %>
    </h5>
</div>
<div class="wrap">
    <div class="canvas">
        <div class="left_column">
        <div class="header_left">
            <div class="header_leftrowone">&nbsp;</div>
            <div class="header_leftrowtwo"><img src="../image/cpt_hook_banner1.jpg" width="123" height="87" /></div>
            <div class="header_leftrowthree"></div>
        </div>
        <div class="leftnav">
            <ul>
                <li></li>
            </ul>
        </div>
        <div>
        <p><strong><span class="style1 style7">Member Login Area:</span></strong></p>
        <form action='LoginServlet' method='post'>
            <table border="1" cellpadding="2" align="center" width="10">
                <tr>
                    <td><span class="style7">User ID:</span></td>
                    <td><input name='name' type='text' size="11" maxlength="10" /></td>
                </tr>
                <tr>
                    <td><span class="style7">Password:</span></td>
                    <td><input name='password' type='password' size="11" maxlength="10" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2"><input name='Submit' type='Submit' value='Login' />
                    <input name='Reset' type='Reset' value='Reset' /></td>
                </tr>
            </table>
            <p>
                <script src="forgetpassword.js"></script>
            </p>
            <p>
                <script src="mainCatalogue.js"></script>
            </p>
            <p>
                <script src="register.js"></script>
            </p>
        </form>
        </p>
    </div>
</div>
<div class="right_column">
<div class="header_right">
    <div class="header_rightrowone">&nbsp;</div>
    <div class="header_rightrowtwo">&nbsp;</div>
    <div class="header_rightrowthree">
        <ul class="topmenu">
            <li><a title="Home" 
                   href="index.jsp">Home</a> | </li>
            <li><a title="Information" 
                   href="companybackground.html">Information</a> |
            <li><a title="Forum" 
                   href="http://www.voy.com/206926/">Discussion Forum</a></li>
        </ul>
    </div>
</div>
<div class="content_wrapper">
<div class="content_left">
    <div>
        <h1>Welcome to the Captain Hook's store</h1>
        <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','400','height','343','align','middle','src','welcome','quality','high','pluginspage','http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash','movie','welcome' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="400" height="343" align="middle">
            <param name="movie" value="welcome.swf">
            <param name="quality" value="high">
            <embed src="welcome.swf" width="430" height="343" align="middle" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash">
        </object></noscript>
        <%
        //----------------banner------------------------
        final int MAX_MARQUEE = 20;
        
        int size = ModelBean.getTotalRecordCountImage();
        
        Connection con2 = util.ConnectionManager.connect();
        Statement stmt2 = con2.createStatement();
        ResultSet rs2 = stmt2.executeQuery("select imageURL as ii from model");
        
        int numOfImg = 0;
        if(size < MAX_MARQUEE) {
            numOfImg = size;
        }else {
            numOfImg = MAX_MARQUEE;
        }
        
        int[] randoms = new int[numOfImg];
        Random r = new Random();
        for (int i=0; i<numOfImg; i++) {
            int z = r.nextInt(size);
            for(int j=0; j<=i; j++) {
                if (randoms[j] == z) {
                    z = r.nextInt(size);
                    j = 0;
                    z = -999;
                    continue;
                } 
            }
            randoms[i] = z;
        }
        
        String[] urls = new String[numOfImg];
        String url = null;
        int x=0,y=0;
        while(rs2.next()) {
            x++;
            url = rs2.getString("ii");
            for(int j=0; j<randoms.length; ++j) {
                if(randoms[j] == x) {
                    urls[y] = url;
                    y++;
                }
            }
        }
        
        
        %>
        <br>
        <br>
        <h1>Hot Items:</h1>
        <p>
            <marquee width="430" height="180" align="center">
                <%  
                for( int i=0; i<numOfImg; ++i) {
            out.println("<a href='ItemDetail.jsp?imageURL="+urls[i]+"'><img height='180' width='160' border='0' src='../image/" + urls[i] + "'/></a>");
                }
        //--------------------------end of banner
                %>
            </marquee>
        </p>
        <p>
            <center>
                Not a member? You may register by clicking
                <script src="register.js"></script>
        .</center></p>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
        <p>&nbsp;</p>
    </div>
    <div class="post_btm"> </div>
</div>
<div class="content_right">
<div align="center"><strong>Headlines</strong> </div>
<p><strong><span class="style5">News:</span></strong></p>
<p> <strong>Funtoys 1/6 Custom Action Figure  						Leon The Professional </a></strong></p>
<p><span class="style3">In Stock Now!!</span></p>
<p><strong>Funtoys Macross 1/6 Custom Action Figure Hikaru Ichijo -Uniform version,  						Hikaru Ichijo -   						Spacesuit version,  						Roy Fokker -   						Spacesuit version </a></strong></p>
<p><strong>In Stock Now!!</a></strong></p>
<p><strong>Armoury 1/6 Action Figure GEBIRGSJAGER, IDF Givati Recon, IDF Paratrooper,   						JGSDF Motorcycle Recon </a></strong></p>
<p><strong>In Stock Now!!</a></strong></p>
<br>
<br>
<div class="rightbox_a"></div>
</div>
</div>
<div class="footer">
    <ul class="basemenu">
        <li></li>
    </ul>
    Designed by Captain Hook inc, all rights reserved. <br />
</div>
</div>
</div>
</div>
</body>
</html>
